package customize

import (
	"gitcode.com/G-YT/baoyou/server/model/cms"
)

// SolarTerms 节气结构体
type SolarTerms struct {
	ID   uint   `json:"id" form:"id" gorm:"column:id;comment:id;"`
	Name string `json:"name" form:"name" gorm:"column:name;comment:节气名称;size:255;"` //节气名称
}

// SolarTermsArticle 节气文章
type SolarTermsArticle struct {
	SolarTermsID uint         `json:"solar_terms_id" from:"solar_terms_id" gorm:"column:solar_terms_id;"`
	ArticleID    uint         `json:"article_id" gorm:"column:article_id;"`
	Type         string       `json:"type" gorm:"column:type;"`
	SolarTerms   *SolarTerms  `json:"-" form:"-" gorm:"->;foreignKey:SolarTermsID;references:ID;"` // 关联节气
	AudioArticle *cms.Article `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`    // 关联音频文章
	VideoArticle *cms.Article `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`    // 关联视频文章
	TextArticle  *cms.Article `json:"-" form:"-" gorm:"->;foreignKey:ArticleID;references:ID;"`    // 关联文本文章
}

func (SolarTerms) TableName() string {
	return "by_solar_terms"
}

func (SolarTermsArticle) TableName() string {
	return "by_solar_terms_article"
}
